// pages/bookHotel/bookHotel.js

var finalPrice;
var name;
var roomCount;
var startDate;
var endDate;
var discount;
var roomNum;
var arriveTime;
var date;
var customer;
var roomType;
var remark;

Page({

     /**
      * 页面的初始数据
      */
     data: {
          finalPrice,
          name,
          roomCount,
          startDate,
          endDate,
          discount,
          arriveTime,
          customer,
          roomType,
          remark
     },

     /**
      * 生命周期函数--监听页面加载
      */
     onLoad: function (options) {
          console.log(options);
          finalPrice = options.finalPrice;
          name = options.name;
          roomCount = options.roomCount;
          arriveTime=options.startDate;
          discount=options.originalPrice-options.finalPrice;
          roomType=options.roomType;
          remark=options.remark;

          var customerList = decodeURIComponent(options.customerList);
          customerList = JSON.parse(customerList);
          customer='';
          for(var i=0;i<customerList.length;i++){
               customer+=customerList[i].name;
               customer+=' ';
          }

          startDate = options.startDate;
          date=startDate.split(' ');
          startDate=date[0];
          
          endDate = options.endDate;
          date=endDate.split(' ');
          endDate=date[0];

          this.setData({
               finalPrice: finalPrice,
               name: name,
               roomCount: roomCount,
               startDate: startDate,
               endDate: endDate,
               discount:discount,
               arriveTime:arriveTime,
               customer:customer,
               roomType:roomType,
               remark:remark
          });
     },

     /**
      * 生命周期函数--监听页面初次渲染完成
      */
     onReady: function () {

     },

     /**
      * 生命周期函数--监听页面显示
      */
     onShow: function () {

     },

     /**
      * 生命周期函数--监听页面隐藏
      */
     onHide: function () {

     },

     /**
      * 生命周期函数--监听页面卸载
      */
     onUnload: function () {

     },

     /**
      * 页面相关事件处理函数--监听用户下拉动作
      */
     onPullDownRefresh: function () {

     },

     /**
      * 页面上拉触底事件的处理函数
      */
     onReachBottom: function () {

     },

     /**
      * 用户点击右上角分享
      */
     onShareAppMessage: function () {

     }
})